翻訳と辞書 |
Automatic memory allocation : ウィキペディア英語版 | Automatic variable __NOTOC__ In computer programming, an automatic variable is a local variable which is allocated and deallocated automatically when program flow enters and leaves the variable's scope. The scope is the lexical context, particularly the function or block in which a variable is defined. Local data is typically (in most languages) invisible outside the function or lexical context where it is defined. Local data is also invisible and inaccessible to a ''called'' function,〔unless it is a nested function, which itself is ''defined'' along that local data〕 but is not deallocated, coming back in scope as the execution thread returns to the caller. Automatic local variables primarily applies to recursive lexically-scoped languages.〔although they exist in a somewhat similar, but not identical, form also in recursive languages with dynamic scoping, such as older variants of LISP〕 Automatic local variables are normally allocated in the stack frame of the procedure in which they are declared.〔unless otherwise specified, such as static or heap-based data, which are specifiable in some languages〕 This was originally done to achieve re-entrancy and allowing recursion,〔When the reentrant property of the routine is used, for recursion or otherwise, the optimizer must ''not'' try to allocate such variables in processor registers (for efficiency) as this would break the reentrancy.〕 considerations that still applies today. The concept of automatic variables in recursive (and nested) functions in a lexically scoped language was introduced to the wider audience with ALGOL in the late 1950s, and further popularized by its many descendants. The term ''local variable'' is usually synonymous with automatic variable, since these are the same thing in many programming languages, but local is more general – most local variables are automatic local variables, but static local variables also exist, notably in C. For a static local variable, the allocation is static (the lifetime is the entire program execution), not automatic, but it is only in scope during the execution of the function. ==In specific programming languages==
抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Automatic variable」の詳細全文を読む
スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース |
Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.
|
|